<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="new :: common_head(能源属性)">
</head>
<style>
    .mylabel{
        display: inline;
    }
    .greenColor{
        color:green;
    }
    .redColor{
        color:red;
    }
</style>
<body>
<!--删除提示模态框-->
<div class="modal fade" id="delcfmModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">提示</h4>
            </div>
            <div class="modal-body">是否要删除？</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="deleteProperty()">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!--删除提示模态框结束-->
<!-- start: Header -->
<div th:replace="~{new::header}"></div>
<!-- start: Header -->

<div class="container-fluid-full">
    <div class="row-fluid">

        <!-- start: Main Menu -->
        <div id="sidebar-left" class="span2" th:replace="new::sidebar_left"></div>
        <!-- end: Main Menu -->

        <noscript>
            <div class="alert alert-block span10">
                <h4 class="alert-heading">Warning!</h4>
                <p>You need to have <a href="" target="_blank">JavaScript</a> enabled to use this site.</p>
            </div>
        </noscript>

        <!-- start: Content -->
        <div id="content" class="span10">


            <ul class="breadcrumb">
                <li>
                    <i class="icon-home"></i>
                    <a th:href="@{/new.html}">主页</a>
                    <i class="icon-angle-right"></i>
                </li>
                <li><a href="#">图谱信息修改</a></li>
            </ul>

            <div class="row-fluid sortable">
                <div class="box span12">
                    <div class="box-header" data-original-title>
                        <h2><i class="halflings-icon white edit"></i><span class="break"></span>图谱信息修改</h2>
                    </div>
                    <div class="box-content">
                        <!--<form class="form-horizontal"  th:action="@{/device/addDevice}" method="post">-->
                        <form id="form1" class="form-horizontal"  >
                            <input type="hidden" id="graphId" name="graphId" th:value="${graphInfo.graphId}">
                            <fieldset>
                                <div class="control-group">
                                    <label class="control-label">图谱ID</label>
                                    <div class="controls">
                                        <span class="input-xlarge uneditable-input" th:value="${graphInfo.graphId}" th:text="${graphInfo.graphId}"  ></span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">图谱名称</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" type="text" placeholder=""
                                               name="graphName"  th:value="${graphInfo.graphName}" required="required" id="graphName">
                                        <div style="display: inline" id="checkName">
                                        </div>
                                        <span style="color:red;font-size: 20px" >*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">图谱使用时间</label>
                                    <div class="controls">
                                        <!--<input class="input-xlarge focused" type="text" placeholder=""-->
                                        <!--name="cap" id="cap">-->
                                        <input type="date" id="timeStart" name="graphStartTime" th:value="${graphInfo.graphStartTime}"  class="input-xlarge focused">
                                        <span>至</span>
                                        <input type="date" id="timeEnd"  name="graphEndTime"  th:value="${graphInfo.graphEndTime}" class="input-xlarge focused">
                                        <span style="color:red;font-size: 20px" >*</span>
                                    </div>
                                </div>
                                <!--<div class="control-group">-->
                                <!--<label class="control-label">能源属性图片</label>-->
                                <!--<div class="controls">-->
                                <!--<input class="input-xlarge focused" onchange="previewPic()" type="file" id="icon" accept="image/jpg,image/jpeg,image/png,image/PNG" placeholder=""-->
                                <!--name="icon" >-->
                                <!--</div>-->
                                <!--</div>-->
                                <div class="form-actions">
                                    <button type="submit" class="btn btn-primary" onclick="editGraph();return false">提交</button>
                                    <button  type="button" class="btn btn-primary" onclick="toDevice()">返回</button>
                                </div>
                            </fieldset>
                        </form>

                    </div>
                </div><!--/span-->

            </div><!--/row-->
        </div>
    </div>
</div>
<div class="clearfix"></div>
<div th:replace="new::common_js"></div>
<script>
    //修改图谱
     function editGraph(){
         var graphName=document.getElementById("graphName");//图谱名称
         var startTime=document.getElementById("timeStart");//开始使用时间
         var endTime=document.getElementById("timeEnd");//结束时间
         if(graphName.value==""){
             layer.alert('图谱名称不能为空', {

                 icon: 5,

                 title: "提示"

             });return false;
         }
         if(startTime.value==""){
             layer.alert('起始时间不能为空', {

                 icon: 5,

                 title: "提示"

             });return false;
         }
         if(endTime.value==""){
             layer.alert('终止时间不能为空', {

                 icon: 5,

                 title: "提示"

             });return false;
         }
         if(endTime.value<=startTime.value){
             layer.alert('终止时间必须大于起始时间', {

                 icon: 5,

                 title: "提示"

             });return false;
         }
         //提交修改接口
         $.ajax({
             type: "POST",
             dataType:"json",
             url: "/power/graphInfo/update",
             data:$("#form1").serialize(),
             success: function(data){
                 console.log(data);
                 window.location.href = "/power/graphInfo/viewGraphInfo";
             },
         })
     }
</script>
</body>
</html>
